
# ifndef __DFX_CORE_H__
# define __DFX_CORE_H__

# define DFX_WINDOWS        1
# define DFX_ANDROID        2
# define DFX_APPLE          3
# define DFX_LINUX          4

# if defined _WIN32
    # define DFX_PLATFORM   DFX_WINDOWS
# elif defined __ANDROID__
    # define DFX_PLATFORM   DFX_ANDROID
# elif defined __APPLE__
    # define DFX_PLATFORM   DFX_APPLE
# elif defined __linux__
    # define DFX_PLATFORM   DFX_LINUX
# else
    # error "DFXEngine - Unsupported platform"
# endif

# if DFX_PLATFORM == DFX_WINDOWS
    # if defined DFX_BUILD
        # define DFX_EXPORT     __declspec(dllexport)
        # define DFX_IMPORT     __declspec(dllimport)
    # else
        # define DFX_EXPORT     __declspec(dllimport)
        # define DFX_IMPORT     __declspec(dllexport)
    # endif
    
    # define DFX_EXPORT_ONLY    __declspec(dllexport)
    # define DFX_IMPORT_ONLY    __declspec(dllimport)
# else
    # define DFX_EXPORT
    # define DFX_IMPORT
    # define DFX_EXPORT_ONLY
    # define DFX_IMPORT_ONLY
# endif

# if defined _DEBUG
    # define DFX_DEBUG  1
# endif

# ifdef _MSC_VER
    # pragma warning (disable:4996)
    # pragma warning (disable:4251)
# endif

# include "dfxError.h"
# include <cstdio>
# include <cstdlib>
# include <cstdarg>
# include <ctime>
# include <string>
# include <vector>
# include <map>

# define MAXBUF             512

#if !defined __BASE_FILE__
    # define __BASE_FILE__  (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)
# endif

# define SAFE_DELETE(p)     { if (p) { delete p; p = NULL; } }
# define SAFE_RELEASE(p)    { if (p) { p->Release(); p = NULL; } }

# define DFX_PI				3.141592653589793f
# define DFX_TWOPI			6.2831853071795862f
# define DFX_TORADIANS(x)	((x) * 0.017453292519943295f)
# define DFX_TODEGREES(x)	((x) * 57.29577951308232f)

namespace DFX
{
# if defined _MSC_VER
    typedef __int8              Int8;
    typedef __int16             Int16;
    typedef __int32             Int32;
    typedef __int64             Int64;

    typedef unsigned __int8     UInt8;
    typedef unsigned __int16    UInt16;
    typedef unsigned __int32    UInt32;
    typedef unsigned __int64    UInt64;
# else
    typedef char                Int8;
    typedef short               Int16;
    typedef int                 Int32;
    typedef long long           Int64;

    typedef unsigned char       UInt8;
    typedef unsigned short      UInt16;
    typedef unsigned int        UInt32;
    typedef unsigned long long  UInt64;
# endif

    typedef float               Float32;
    typedef double              Float64;
    typedef long                DFXRESULT;
    typedef std::string         String;  

    typedef std::vector<String> StringArray;
    typedef std::vector<UInt8>  UInt8Array;
}

# endif